<?php
    include_once ('inc/class/User.class.php');
    include_once ('inc/global/global.inc.php');
//    include_once ('inc/code/headIndex.php');
    include_once ('inc/class/Form.class.php');
    include_once ('inc/class/Util.class.php');


//    if(!isset($utente))
//        $utente = new User();

    if(isset($_POST["user"])){
        User::modifica_utente($_POST['name'],$_POST['cognome'],$_POST['email'],$_POST['username'],$_POST['password'],$_POST['number'],$_POST['cap'],$_POST['citta'],$_POST['date'],$_POST['indirizzo']);


//       Util::logoutRedirect();
    }

      
?>


<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script src="inc/js/multifield.js"></script>
    <script src="inc/js/validator.js"></script>
	<script>
		// initialize the validator function
		validator.message['date'] = 'not a real date';

		// validate a field on "blur" event, a 'select' on 'change' event & a '.reuired' classed multifield on 'keyup':
		$('form')
			.on('blur', 'input[required], input.optional, select.required', validator.checkField)
			.on('change', 'select.required', validator.checkField);

		$('.multi.required')
			.on('keyup', 'input', function(){
				validator.checkField.apply( $(this).siblings().last()[0] );
			}).on('blur', 'input', function(){
				validator.checkField.apply( $(this).siblings().last()[0] );
			});

		// bind the validation to the form submit event
		//$('#send').click('submit');//.prop('disabled', true);

		$('form').submit(function(e){
			e.preventDefault();
			var submit = true;
			// evaluate the form using generic validaing
			if( !validator.checkAll( $(this) ) ){
				submit = false;
			}

			if( submit )
				this.submit();
			return false;
		});

		/* FOR DEMO ONLY */
		$('#vfields').change(function(){
			$('form').toggleClass('mode2');
		}).prop('checked',false);

		$('#alerts').change(function(){
			validator.defaults.alerts = (this.checked) ? false : true;
			if( this.checked )
				$('form .alert').remove();
		}).prop('checked',false);
	</script>
    </div>


<?php
    include ('inc/code/footer.php');
?>